home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
cat
/
wiedervo.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
27KB
|
905 lines
IMPLEMENTATION MODULE WiederVorlage;
FROM SYSTEM IMPORT ADDRESS, TSIZE, ADR, CADR, CAST, ASSEMBLER;
FROM Storage IMPORT ALLOCATE, DEALLOCATE;
IMPORT Strings, StrConv, GrafBase, BinOps, Block;
IMPORT MagicAES, MagicDOS, MagicVDI, MagicStrings, mtAppl, mtAlerts,
mtUtils;
FROM Void IMPORT v;
FROM ListDl IMPORT ldElems;
IMPORT ListDl;
IMPORT CatTypes, data, dataSys, MausTauschrsc, MTE, GroupSelect, CatGlobal,
CatHelp, CatFiles, ConvertDate, MTPaths, CatOpts2, grin,
QuickSort, ConfVars, Varnames;
IMPORT WinDials;
TYPE resubRec = RECORD
group : CatTypes.Str255Ptr;
msgId : CatTypes.Str255Ptr;
from : CatTypes.Str255Ptr;
topic : CatTypes.Str255Ptr;
date : ConvertDate.Date;
time : ConvertDate.Time;
resubDate: ConvertDate.Date;
selected : BOOLEAN;
dataLength: CARDINAL;
data : ADDRESS;
END;
resubPtr = POINTER TO resubRec;
CONST (* Magics fr Header *)
resubCatMagic = 43415457H; (* "CATW" *)
resubVersion = 1; (* Versionsnummer der Wiedervorlage *)
resubVersionMagic = 0100H; (* Versionsmagic *)
CONST resubDataName = 'catresub.dat';
delWVAlt = "[2][CAT:|Wollen Sie den selektierten|Eintrag wirklich lschen?][[Ja|:[Nein]";
doWVAlt1 = "[2][CAT:|Es ";
doWVMsg0 = "lieg";
doWVMsg = " Nachricht";
doWVAlt2 = " zur|Wiedervorlage vor. Soll die|Erste davon angezeigt werden?][[Ja|:[Nein]";
TYPE
resubHdr = RECORD
group, (* Offsets in Data hinein, der *)
msgId,
from,
topic : CARDINAL;
date : ConvertDate.Date;
time : ConvertDate.Time;
resubDate : ConvertDate.Date;
dataLength : CARDINAL; (* Die Lnge des folgenden Datenblocks *)
END;
TYPE
resubArrayType = ARRAY [0..$7FFF] OF resubRec;
resubArrayPtr = POINTER TO resubArrayType;
VAR listModified: BOOLEAN;
resubArray : resubArrayPtr;
maxResubs : INTEGER;
resubs : INTEGER; (* aktueller Index in Array *)
globalLength : INTEGER;
maxLength : INTEGER;
currIdx : INTEGER;
wvWindow : INTEGER;
resubForm : mtUtils.tObjcTree;
specials : ARRAY [0..3] OF ListDl.specialButHdler;
dialHandler : ListDl.ldHandler;
PROCEDURE MakeNewResubArray (force : BOOLEAN; new : CARDINAL) : BOOLEAN;
(* Alloziert ein neues Gruppenarray und kopiert das alte hinein.
* FALSE: Nicht genug Speicher!
*)
VAR i : INTEGER;
newMax : CARDINAL;
newArray : resubArrayPtr;
BEGIN
IF (maxResubs = 0) OR (resubs >= maxResubs - 1) OR force
THEN
IF force
THEN
newMax := new + 20;
ELSE
newMax := maxResubs + 20;
END;
ALLOCATE (newArray, LONG(newMax) * TSIZE (resubRec));
IF newArray = NIL
THEN RETURN FALSE END;
Block.Clear (newArray, LONG(newMax)*TSIZE(resubRec));
IF resubArray # NIL
THEN
FOR i := 0 TO INTEGER(maxResubs) - 1 DO newArray^[i] := resubArray^[i] END;
END;
DEALLOCATE (resubArray, 0);
maxResubs := newMax;
resubArray := newArray;
END;
RETURN TRUE;
END MakeNewResubArray;
PROCEDURE MakeEntry (rs: resubPtr; VAR gName, mId, fromL, topicL : ARRAY OF CHAR;
dt : ConvertDate.Date; ti: ConvertDate.Time; resubDt : ConvertDate.Date): BOOLEAN;
(* Fllt den Eintrag rs mit den Daten
*)
VAR gLen,
mLen,
fLen,
tLen : INTEGER;
addLen : INTEGER;
target : ADDRESS;
BEGIN
(* Lngen herausfinden *)
gLen := (*SYSTEM.*)LENGTH (gName);
mLen := (*SYSTEM.*)LENGTH (mId);
fLen := (*SYSTEM.*)LENGTH (fromL);
tLen := (*SYSTEM.*)LENGTH (topicL);
addLen := gLen + mLen + fLen + tLen + 8;
(* Jetzt Speicher allozieren *)
rs^.dataLength := 0;
ALLOCATE (rs^.data, addLen);
IF rs^.data = NIL THEN RETURN FALSE END;
rs^.dataLength := addLen;
(* Speicher vorhanden, jetzt Eintrge setzen *)
target := rs^.data;
INC (gLen);
Block.Copy (ADR(gName), gLen, target);
rs^.group := target;
INC (target, gLen);
IF mLen > 0 THEN
INC (mLen);
Block.Copy (ADR(mId), mLen, target);
rs^.msgId := target;
INC (target, mLen);
ELSE
rs^.msgId := NIL;
END;
IF fLen > 0 THEN
INC (fLen);
Block.Copy (ADR(fromL), fLen, target);
rs^.from := target;
INC (target, fLen);
ELSE
rs^.from := NIL
END;
IF tLen > 0 THEN
INC (tLen);
Block.Copy (ADR(topicL), tLen, target);
rs^.topic := target;
INC (target, tLen);
ELSE
rs^.topic := NIL
END;
rs^.date := dt;
rs^.time := ti;
rs^.resubDate := resubDt;
RETURN TRUE;
END MakeEntry;
(*----- Eigene Liste schreiben und lesen ------------------------------*)
(* Format der Datei, in der die Liste abgespeichert wird:
* Pro Eintrag eine Zeile, die einzelnen Elemente sind getrennt durch ein
* TAB-Zeichen (das kommt definitiv nie in Gruppennamen vor).
* <name>TAB<netname>TAB<chef>TAB<kurztext>TAB<sysopinfo>TAB<followupto>TAB<readNumber>TAB<catNumber>TAB<flags>
* Dabei werden die Flags wie im ITG gespeichert.
*)
PROCEDURE SaveResubList(): BOOLEAN;
VAR fname : CatTypes.String255;
i : INTEGER;
dbHdr : dataSys.FileHeaderType;
fhdl : INTEGER;
PROCEDURE saveDataEntry (e, i : ADDRESS): BOOLEAN;
VAR rs : resubPtr;
hdr : resubHdr;
fPtr : POINTER TO INTEGER;
BEGIN
rs := resubPtr (e);
fPtr := i;
WITH hdr DO
group := 0;
msgId := 0;
from := 0;
topic := 0;
IF rs^.msgId # NIL THEN msgId := SHORT(LONGCARD(rs^.msgId - rs^.data)) ; END;
IF rs^.from # NIL THEN from := SHORT(LONGCARD(rs^.from - rs^.data)); END;
IF rs^.topic # NIL THEN topic := SHORT(LONGCARD(rs^.topic - rs^.data)); END;
(* Jetzt die brigen Daten setzen *)
date := rs^.date;
time := rs^.time ;
resubDate := rs^.resubDate ;
dataLength := rs^.dataLength;
END;
CatFiles.WriteMuch (TSIZE (resubHdr), fPtr^, ADR(hdr));
IF CatFiles.FileError # CatFiles.NoError
THEN
RETURN FALSE
END;
(* Jetzt die Daten schreiben *)
CatFiles.WriteMuch (hdr.dataLength, fPtr^, rs^.data);
RETURN CatFiles.FileError = CatFiles.NoError;
END saveDataEntry;
BEGIN
MagicStrings.Assign (MTPaths.DataPath, fname);
MagicStrings.Append (resubDataName, fname);
listModified := FALSE;
(* Jetzt das Binrfile schreiben *)
fhdl := CatFiles.CreateFile (MTPaths.DataPath, resubDataName);
IF fhdl > 0
THEN
(* Header schreiben *)
dbHdr.CatMagic := resubCatMagic;
dbHdr.Version := resubVersion;
dbHdr.VersionMagic := resubVersionMagic;
CatFiles.WriteMuch (dataSys.dbHeaderLength, fhdl, ADR(dbHdr));
IF CatFiles.FileError # CatFiles.NoError
THEN
MTE.InfoAlert (MTE.noFile1, resubDataName, MTE.noFile4);
CatFiles.CloseFile (fhdl);
RETURN FALSE;
END;
i := 0;
WHILE (i < resubs) &
saveDataEntry (ADR(resubArray^[i]), ADR(fhdl)) DO INC (i) END;
CatFiles.CloseFile (fhdl);
RETURN TRUE;
ELSE
(* Fehlermeldung rauswerfen *)
MTE.InfoAlert (MTE.noFile1, resubDataName, MTE.noFile4);
RETURN FALSE;
END;
END SaveResubList;
PROCEDURE ReadResubList(): BOOLEAN;
VAR fname : CatTypes.String255;
fhdl : INTEGER;
lc : CARDINAL;
PROCEDURE parseData(): BOOLEAN;
VAR dbHdr : dataSys.FileHeaderType;
hdr : resubHdr;
rs : resubPtr;
BEGIN
(* Aufbau der CATGROUP.DAT:
* fileHeader
* pro Gruppe:
* Header
* Textdaten (variabel)
*)
CatFiles.ReadMuch (dataSys.dbHeaderLength, fhdl, ADR(dbHdr));
IF CatFiles.FileError # CatFiles.NoError
THEN
RETURN FALSE
END;
(* Jetzt berprfen des Headers *)
IF (dbHdr.CatMagic # resubCatMagic)
OR (dbHdr.Version # resubVersion)
OR (dbHdr.VersionMagic # resubVersionMagic)
THEN
(* Abbrechen *)
RETURN FALSE
END;
(* hier eventuell mal zhlen, wie viele es denn sind *)
IF ~MakeNewResubArray (TRUE, 50)
THEN
RETURN FALSE
END;
resubs := 0;
REPEAT
(* Header lesen *)
CatFiles.ReadMuch (TSIZE (resubHdr), fhdl, ADR(hdr));
IF CatFiles.FileError = CatFiles.NoError
THEN
(* Ok, Header gelesen *)
IF ~MakeNewResubArray (FALSE, 0)
THEN
RETURN FALSE
END;
(* Jetzt Eintrag setzen *)
rs := ADR (resubArray^[resubs]);
ALLOCATE (rs^.data, hdr.dataLength);
IF rs^.data = NIL THEN RETURN FALSE END;
(* Jetzt Daten kopieren *)
WITH rs^ DO
(* Pointer setzen *)
group := data;
msgId := NIL;
from := NIL;
topic := NIL;
IF hdr.msgId # 0 THEN msgId := data + ADDRESS(LONG(hdr.msgId)); END;
IF hdr.from # 0 THEN from := data + ADDRESS(LONG(hdr.from)); END;
IF hdr.topic # 0 THEN topic := data + ADDRESS(LONG(hdr.topic)); END;
(* Jetzt die brigen Daten setzen *)
date := hdr.date ;
time := hdr.time ;
resubDate := hdr.resubDate ; (* F-Zeile *)
selected := FALSE ; (* Fr Darstellung in Liste, wird beim Einlesen auf FALSE gesetzt *)
dataLength := hdr.dataLength; (* Die Lnge des folgenden Datenblocks *)
END;
(* Jetzt Daten lesen *)
CatFiles.ReadMuch (hdr.dataLength, fhdl, rs^.data);
IF CatFiles.FileError # CatFiles.NoError
THEN
(* Lesefehler, abbrechen *)
RETURN FALSE
END;
INC (resubs);
END;
UNTIL CatFiles.FileError # CatFiles.NoError;
RETURN TRUE;
END parseData;
VAR size : LONGCARD;
exists: BOOLEAN;
i : INTEGER;
BEGIN
mtAppl.MouseOn();
mtAppl.MouseBusy();
IF resubArray # NIL THEN DEALLOCATE (resubArray, 0); END;
resubs := 0;
maxResubs := 0;
MagicStrings.Assign (MTPaths.DataPath, fname);
MagicStrings.Append (resubDataName, fname);
size := CatFiles.FileSize (fname, exists);
IF exists & (size > 0)
THEN
fhdl:= CatFiles.OpenFile (MTPaths.DataPath, resubDataName, CatFiles.readFile);
IF fhdl > 0
THEN
IF ~parseData()
THEN
IF resubArray # NIL THEN DEALLOCATE (resubArray, 0); END;
resubs := 0;
maxResubs := 0;
CatFiles.CloseFile (fhdl);
RETURN FALSE;
ELSE
CatFiles.CloseFile (fhdl);
listModified := FALSE;
mtAppl.MouseArrow();
RETURN TRUE;
END;
END;
ELSE
(* Leeres Array anlegen *)
IF ~MakeNewResubArray (TRUE, 10)
THEN
RETURN FALSE
END;
resubs := 0;
END;
RETURN TRUE;
END ReadResubList;
PROCEDURE DeleteEntry (idx: INTEGER);
VAR i : INTEGER;
BEGIN
IF (idx < 0) OR (idx >= resubs) THEN RETURN END;
FOR i := idx+1 TO resubs-1 DO
(* Eintrge runterkopieren *)
resubArray^[i-1] := resubArray^[i];
END;
DEC (resubs);
listModified := TRUE;
END DeleteEntry;
PROCEDURE sortDate (e1, e2: ADDRESS): BOOLEAN;
VAR pResub1, pResub2: resubPtr;
BEGIN
pResub1 := e1;
pResub2 := e2;
RETURN ConvertDate.PackDate (pResub1^.resubDate) < ConvertDate.PackDate (pResub2^.resubDate);
END sortDate;
PROCEDURE SortResubs();
BEGIN
v.bool := QuickSort.sortIt (0, resubs-1, resubArray^, sortDate,
TSIZE (resubRec), QuickSort.noBreak);
END SortResubs;
(*----------------------------------------------------------------------
* "Listen"prozeduren
*----------------------------------------------------------------------*)
PROCEDURE BuildLine1 (entry: ADDRESS; VAR str: ARRAY OF CHAR);
VAR pResub : resubPtr;
BEGIN
pResub := entry;
WITH pResub^ DO
IF from # NIL
THEN
CatGlobal.KurzName (from^, str, 25);
ELSE
CatGlobal.KurzName ("Anonym", str, 25);
END;
MagicStrings.Append (" ", str);
IF group # NIL THEN
MagicStrings.Append (group^, str);
END;
MagicStrings.Append (" ", str);
END;
END BuildLine1;
PROCEDURE BuildLine2 (entry: ADDRESS; VAR str: ARRAY OF CHAR);
VAR pResub : resubPtr;
tmpStr : ARRAY [0..39] OF CHAR;
BEGIN
pResub := entry;
WITH pResub^ DO
MagicStrings.Assign (" Wv: ", str);
ConvertDate.DateToText (resubDate, "DD.MM.YY", tmpStr);
MagicStrings.Append (tmpStr, str);
MagicStrings.Append (" Vom: ", str);
ConvertDate.DateToText (date, "DD.MM.YY", tmpStr);
MagicStrings.Append (tmpStr, str);
MagicStrings.Append (" ", str);
IF topic # NIL THEN
MagicStrings.Append (topic^, str);
END;
MagicStrings.Append (" ", str);
END;
END BuildLine2;
PROCEDURE CountEntries ( l : ADDRESS; VAR ll: LONGINT; VAR ww: INTEGER);
BEGIN
ww := globalLength*mtAppl.CharWidth;
ll := LONG (resubs);
END CountEntries;
PROCEDURE NextEntry ( l : ADDRESS) : ADDRESS;
BEGIN
IF currIdx < resubs
THEN
INC (currIdx);
RETURN ADR(resubArray^[currIdx-1]);
ELSE
RETURN NIL;
END;
END NextEntry;
PROCEDURE PrevEntry ( l : ADDRESS) : ADDRESS;
BEGIN
IF currIdx > 0
THEN
DEC (currIdx);
RETURN ADR(resubArray^[currIdx]);
ELSE
RETURN NIL;
END;
END PrevEntry;
PROCEDURE ResetResubs (l: ADDRESS);
BEGIN
currIdx := 0;
END ResetResubs;
PROCEDURE resubToStr (entry, env : ADDRESS; VAR str : ARRAY OF CHAR);
END resubToStr;
PROCEDURE selEntry (entry, env : ADDRESS; line : INTEGER) : BOOLEAN;
VAR e : resubPtr;
str : ARRAY [0..255] OF CHAR;
BEGIN
e := entry;
IF e = NIL THEN RETURN FALSE END;
e^.selected := ~e^.selected;
RETURN FALSE
END selEntry;
PROCEDURE isSelected (entry, env : ADDRESS) : BOOLEAN;
VAR ent : resubPtr;
BEGIN
ent := entry;
RETURN ent^.selected;
END isSelected;
PROCEDURE isEnabled (adr : ADDRESS; env : ADDRESS) : BOOLEAN;
BEGIN
RETURN TRUE
END isEnabled;
(*----------------------------------------------------------------------
* Userinterface
*----------------------------------------------------------------------*)
PROCEDURE UpdateButtonWV (entry, env : ADDRESS);
VAR oneSel : BOOLEAN;
changed: BOOLEAN;
i : INTEGER;
BEGIN
(* selektieren Eintrag finden *)
i := 0;
WHILE (i < resubs) & ~resubArray^[i].selected DO
INC (i);
END;
oneSel := i < resubs;
changed := mtUtils.InState (resubForm, MausTauschrsc.wvdel, MagicAES.DISABLED);
changed := changed # (~oneSel);
IF changed
THEN
mtUtils.SetState (resubForm, MausTauschrsc.wvdel, MagicAES.DISABLED, ~oneSel);
mtUtils.SetState (resubForm, MausTauschrsc.wvread, MagicAES.DISABLED, ~oneSel);
mtUtils.SetState (resubForm, MausTauschrsc.wvchange, MagicAES.DISABLED, ~oneSel);
WinDials.WinDialDraw (resubForm, MausTauschrsc.wvdel, 0, v.r, FALSE);
WinDials.WinDialDraw (resubForm, MausTauschrsc.wvread, 0, v.r, FALSE);
WinDials.WinDialDraw (resubForm, MausTauschrsc.wvchange, 0, v.r, FALSE);
END;
END UpdateButtonWV;
PROCEDURE HelpWV (obj : INTEGER; env, env2: ADDRESS; VAR draw, exit : BOOLEAN);
BEGIN
CatHelp.DoHelp (CatHelp.wvhelp);
mtUtils.ExclState (resubForm, obj, MagicAES.SELECTED);
WinDials.WinDialDraw (resubForm, obj, 0, v.r, FALSE);
exit := FALSE;
draw := FALSE;
END HelpWV;
PROCEDURE getIdNumber(ptr : data.OneGroupHandle):CARDINAL;
BEGIN
RETURN data.NumberOfID(ptr, resubArray^[currIdx].msgId^);
END getIdNumber;
PROCEDURE OpenWV (obj : INTEGER; env, env2: ADDRESS; VAR draw, exit : BOOLEAN);
VAR oneSel : BOOLEAN;
i : INTEGER;
gruppe : CARDINAL;
BEGIN
(* selektieren Eintrag finden *)
i := 0;
WHILE (i < resubs) & ~resubArray^[i].selected DO
INC (i);
END;
oneSel := i < resubs;
IF oneSel
THEN
currIdx := i;
IF GroupSelect.GroupNumber (resubArray^[currIdx].group^, gruppe)
THEN
IF wvWindow > 0
THEN
IF ~grin.grinSwitchToMess (wvWindow, gruppe, getIdNumber)
THEN
wvWindow := -1;
wvWindow := grin.grinOpenWithProc (gruppe, getIdNumber, grin.grinNextMess, 0, grin.mOther);
END;
ELSE
wvWindow := grin.grinOpenWithProc (gruppe, getIdNumber, grin.grinNextMess, 0, grin.mOther);
END;
END;
END;
mtUtils.ExclState (resubForm, obj, MagicAES.SELECTED);
WinDials.WinDialDraw (resubForm, obj, 0, v.r, FALSE);
exit := FALSE;
draw := FALSE;
END OpenWV;
PROCEDURE ChangeWV (obj : INTEGER; env, env2: ADDRESS; VAR draw, exit : BOOLEAN);
VAR theDate : ARRAY [0..39] OF CHAR;
oneSel : BOOLEAN;
i : INTEGER;
BEGIN
(* selektieren Eintrag finden *)
i := 0;
WHILE (i < resubs) & ~resubArray^[i].selected DO
INC (i);
END;
oneSel := i < resubs;
draw := FALSE;
IF oneSel
THEN
ConvertDate.DateToText (resubArray^[i].resubDate, "dd.mm.YYYY", theDate);
IF CatOpts2.DatumHolen (TRUE, theDate)
THEN
ConvertDate.TextToDate (theDate, resubArray^[i].resubDate, v.bool);
listModified := TRUE;
draw := TRUE;
SortResubs();
END;
END;
mtUtils.ExclState (resubForm, obj, MagicAES.SELECTED);
WinDials.WinDialDraw (resubForm, obj, 0, v.r, FALSE);
exit := FALSE;
END ChangeWV;
PROCEDURE DeleteWV (obj : INTEGER; env, info: ADDRESS; VAR draw, exit : BOOLEAN);
VAR oneSel : BOOLEAN;
i : INTEGER;
BEGIN
draw := FALSE;
(* selektieren Eintrag finden *)
i := 0;
WHILE (i < resubs) & ~resubArray^[i].selected DO
INC (i);
END;
oneSel := i < resubs;
IF oneSel
THEN
v.int := mtAlerts.Alert (1, delWVAlt);
IF v.int = 1
THEN
DeleteEntry (i);
draw := TRUE;
END;
END;
mtUtils.ExclState (resubForm, obj, MagicAES.SELECTED);
WinDials.WinDialDraw (resubForm, obj, 0, v.r, FALSE);
exit := FALSE;
END DeleteWV;
PROCEDURE drawResubEntry (entry, env : ADDRESS; x, y : INTEGER;
offset : INTEGER; clip : GrafBase.Rectangle);
VAR e : resubPtr;
str : ARRAY [0..255] OF CHAR;
eff : BITSET;
fillcol : INTEGER;
fill: GrafBase.Rectangle;
isSel: BOOLEAN;
BEGIN
e := entry;
fill.x := x;
fill.y := y;
fill.w := fill.x + globalLength*mtAppl.CharWidth-1;
fill.h := fill.y + 2*mtAppl.CharHeight -1 ;
clip.w := clip.x+clip.w-1;
clip.h := clip.y+clip.h-1;
MagicVDI.SetClipping (mtAppl.PrivateWS, clip, TRUE);
v.int := MagicVDI.SetWritemode (mtAppl.PrivateWS, MagicVDI.REPLACE);
fillcol := 0;
isSel := FALSE;
IF (e # NIL) & isSelected (entry, env)
THEN
fillcol := 1;
isSel := TRUE;
END;
mtAppl.MouseOff();
v.int := MagicVDI.SetFillcolor (mtAppl.PrivateWS, fillcol);
MagicVDI.FillRectangle (mtAppl.PrivateWS, fill);
IF e # NIL
THEN
eff := {};
IF ~isEnabled (entry, env)
THEN
INCL (eff, MagicVDI.Light);
END;
IF ConvertDate.PackDate (e^.resubDate) = MagicDOS.Tgetdate()
THEN
INCL (eff, MagicVDI.Fat);
END;
IF isSel
THEN
v.int := MagicVDI.SetWritemode (mtAppl.PrivateWS, MagicVDI.XOR);
END;
(* Jetzt hier den String fr den Gruppennamen zusammenbauen *)
BuildLine1 (e, str);
eff:= MagicVDI.SetTexteffect (mtAppl.PrivateWS, eff);
MagicVDI.Text (mtAppl.PrivateWS, x, y, str);
INC (y, mtAppl.CharHeight);
BuildLine2 (e, str);
MagicVDI.Text (mtAppl.PrivateWS, x, y, str);
eff:= MagicVDI.SetTexteffect (mtAppl.PrivateWS, {});
v.int := MagicVDI.SetWritemode (mtAppl.PrivateWS, MagicVDI.REPLACE);
END;
MagicVDI.SetClipping (mtAppl.PrivateWS, clip, FALSE);
mtAppl.MouseOn();
END drawResubEntry;
PROCEDURE setAndGetResubValues (tree: ADDRESS; private: ADDRESS; set: BOOLEAN; exitBut: INTEGER);
VAR i : INTEGER;
gruppe: CARDINAL;
BEGIN
IF set
THEN
wvWindow := -1;
FOR i := 0 TO resubs - 1 DO
resubArray^[i].selected := FALSE;
END;
mtUtils.SetState (resubForm, MausTauschrsc.wvdel, MagicAES.DISABLED, TRUE);
mtUtils.SetState (resubForm, MausTauschrsc.wvread, MagicAES.DISABLED, TRUE);
mtUtils.SetState (resubForm, MausTauschrsc.wvchange, MagicAES.DISABLED, TRUE);
ELSE
IF exitBut # MausTauschrsc.wvcancel
THEN
IF listModified
THEN
v.bool := SaveResubList();
END;
(*
IF exitBut = MausTauschrsc.wvread
THEN
(* Selektierten Eintrag ffnen *)
IF GroupSelect.GroupNumber (resubArray^[currIdx].group^, gruppe)
THEN
v.int := grin.grinOpenWithProc (gruppe, getIdNumber, grin.grinNextMess, 0, grin.mOther);
END;
END;
*)
ELSE
IF listModified
THEN
(* nderungen verwerfen und einfach neu laden *)
IF resubArray # NIL THEN DEALLOCATE (resubArray, 0); END;
maxResubs := 0;
resubs := 0;
v.bool := ReadResubList();
END;
END;
END;
END setAndGetResubValues;
PROCEDURE SelectResub();
VAR maxLength: INTEGER;
r : GrafBase.Rectangle;
str : ARRAY [0..255] OF CHAR;
i : INTEGER;
BEGIN
(* Jetzt das Object zusammenbauen *)
resubForm := MausTauschrsc.TreeAddr^[MausTauschrsc.wvform];
IF WinDials.IsWinDial (resubForm)
THEN
(* Fenster toppen und rausgehen *)
WinDials.ActivateWinDial (resubForm);
RETURN;
END;
(* Maximale Breite eines Listeneintrages herausfinden *)
maxLength := 0;
FOR i := 0 TO resubs-1 DO
BuildLine1 (ADR(resubArray^[i]), str);
maxLength := BinOps.HigherInt (INTEGER(LENGTH(str)), maxLength);
BuildLine2 (ADR(resubArray^[i]), str);
maxLength := BinOps.HigherInt (INTEGER(LENGTH(str)), maxLength);
resubArray^[i].selected := FALSE;
END;
mtUtils.CalcArea (resubForm, MausTauschrsc.wvbox, r);
maxLength := BinOps.HigherInt (maxLength, r.w DIV mtAppl.CharWidth);
globalLength := maxLength;
(* specials bestimmen *)
specials[0].objc := MausTauschrsc.wvchange;
specials[0].proc := ChangeWV;
specials[1].objc := MausTauschrsc.wvdel;
specials[1].proc := DeleteWV;
specials[2].objc := MausTauschrsc.wvhelp;
specials[2].proc := HelpWV;
specials[3].objc := MausTauschrsc.wvread;
specials[3].proc := OpenWV;
mtUtils.SetState (resubForm, MausTauschrsc.wvdel, MagicAES.DISABLED, TRUE);
mtUtils.SetState (resubForm, MausTauschrsc.wvread, MagicAES.DISABLED, TRUE);
mtUtils.SetState (resubForm, MausTauschrsc.wvchange, MagicAES.DISABLED, TRUE);
(* WindowDialog vorbereiten *)
ListDl.BuildLdHandler (resubArray, ResetResubs, NextEntry, PrevEntry,
CountEntries, isEnabled, selEntry,
resubToStr, isSelected, drawResubEntry,
0, 2*mtAppl.CharHeight,
8, globalLength*mtAppl.CharWidth,
dialHandler);
(* ListWinDialog ffnen *)
IF ListDl.WinListDial (resubForm, ListDl.ldElemSet{ldSelect, ldArrows, ldDoubleExit},
dialHandler,
MausTauschrsc.wvbox,
MausTauschrsc.wvback,
MausTauschrsc.wvok,
MausTauschrsc.wvcancel,
NIL, MausTauschrsc.wvread,
-1,
UpdateButtonWV,
specials,
4,
ListDl.dummyCheckExit,
setAndGetResubValues,
setAndGetResubValues,
v.a)
THEN
END;
END SelectResub;
PROCEDURE AddResub (VAR group, msgId, from, topic: ARRAY OF CHAR;
tDate: LONGCARD);
VAR dt, rsDate : ConvertDate.Date;
ti : ConvertDate.Time;
theDate : ARRAY [0..39] OF CHAR;
BEGIN
(* Datum konvertieren *)
ConvertDate.CatDate2Datim (tDate, dt, ti);
MagicStrings.Assign ("", theDate);
IF CatOpts2.DatumHolen (TRUE, theDate)
THEN
ConvertDate.TextToDate (theDate, rsDate, v.bool);
IF ~MakeNewResubArray (FALSE, 0)
THEN
MTE.noMemAlert();
RETURN
END;
(* Jetzt Eintrag setzen *)
IF ~MakeEntry (ADR (resubArray^[resubs]), group, msgId, from, topic,
dt, ti, rsDate)
THEN
MTE.noMemAlert();
ELSE
INC (resubs);
SortResubs();
v.bool := SaveResubList();
END;
END;
END AddResub;
PROCEDURE CheckForResub ();
VAR today: CARDINAL;
checkDate: CARDINAL;
lastDate : ConvertDate.Date;
i,
count: INTEGER;
gruppe: CARDINAL;
tmp : ARRAY [0..19] OF CHAR;
alertStr : CatTypes.String255;
BEGIN
today := MagicDOS.Tgetdate();
count := 0;
checkDate := today;
IF ConfVars.GetConfigString (cLastResub, alertStr)
THEN
ConvertDate.TextToDate (alertStr, lastDate, v.bool);
IF v.bool
THEN
checkDate := ConvertDate.PackDate (lastDate);
IF checkDate = today THEN RETURN END;
END;
END;
(* Datum abspeichern *)
lastDate := ConvertDate.UnpackDate (today);
ConvertDate.DateToText (lastDate, "DD.MM.YYYY", alertStr);
v.bool := ConfVars.SetConfigString (cLastResub, alertStr);
(* Jetzt prfen *)
FOR i := 0 TO resubs - 1 DO
IF (ConvertDate.PackDate(resubArray^[i].resubDate) >= checkDate)
& (ConvertDate.PackDate(resubArray^[i].resubDate) <= today)
THEN
IF count = 0
THEN
currIdx := i;
END;
INC (count);
END;
END;
IF count > 0
THEN
MagicStrings.Assign (doWVAlt1, alertStr);
CatGlobal.Konjugiere (doWVMsg0, "t ", "en ", count, tmp);
MagicStrings.Append (tmp, alertStr);
MagicStrings.Append (StrConv.IntToStr (count, 0), alertStr);
CatGlobal.Konjugiere (doWVMsg, "", "en", count, tmp);
MagicStrings.Append (tmp, alertStr);
MagicStrings.Append (doWVAlt2, alertStr);
v.int := mtAlerts.Alert (1, alertStr);
IF v.int = 1
THEN
(* Selektierten Eintrag ffnen *)
IF GroupSelect.GroupNumber (resubArray^[currIdx].group^, gruppe)
THEN
v.int := grin.grinOpenWithProc (gruppe, getIdNumber, grin.grinNextMess, 0, grin.mOther);
END;
END;
END;
END CheckForResub;
BEGIN
resubArray := NIL;
resubs := 0;
END WiederVorlage.